import store from './store'

export type TCatalogData = {
	_id: string
	pictures: string
	discount: number
	price: number
	wight: string
	name: string
	likes: string[]
}

type TProductReviewAuthor = {
	name: string
	about: string
	avatar: string
	_id: string
	group: string
	email: string
	__v: number
}

export type TProductReview = {
	rating: number
	_id: string
	text: string
	author: TProductReviewAuthor
	product: string
	created_at: string
	updated_at: string
	__v: number
}

export type TProductData = {
	discount: number
	stock: number
	available: boolean
	pictures: string
	likes: string[]
	reviews: TProductReview[]
	tags: string[]
	isPublished: boolean
	_id: string
	name: string
	author: {
		name: string
		about: string
		avatar: string
		_id: string
		email: string
		group: string
		__v: number
	}
	price: number
	description: string
	created_at: string
	updated_at: string
	__v: number
}

export type TUser = {
	_id: string
	isLoading: boolean
	name: string
	about: string
	avatar: string
	email: string
	password: string
	isAdmin: boolean
	group: string
}

export type RootState = ReturnType<typeof store.getState>
export type AppDispatch = typeof store.dispatch
